package cs2320;

import junit.framework.Assert;

import org.junit.Test;

public class TaxTests {


	@Test
	/**
	 * Tests the taxes with 0 hours. Since there is no
	 * hours worked then there should be no tax.
	 */
	public void testCalculateTaxWithNoHours() {
		final double expectedTax = 0;
		
		double tax = TaxCalculator.calculateTax(0);
		
		Assert.assertEquals(expectedTax, tax);
	}
	
	@Test
	/**
	 * Tests the taxes with 26 hours. This would put the wages below rate
	 * 1 thresh hold
	 */
	public void testCacluateTaxWithWagesLessThanRate1Threshold() {
		
		final double expectedTaxes = 48.75;
		
		double tax = TaxCalculator.calculateTax(26);
		
		Assert.assertEquals(expectedTaxes, tax);
		
	}
	
	@Test
	/**
	 * Test the taxes with 39 hours. This would put it over rate 1 thresh hold and equal to rate 
	 * 2 thresh hold. The logic is flawed and this test should not pass. Look at the logic
	 * The if statements are messed up in calculateTax();
	 */
	public void testCacluateTaxWithWagesLessThanRate2Threshold() {
		
		final double expectedTaxes = 80.625;
		
		double tax = TaxCalculator.calculateTax(39);
		
		Assert.assertEquals(expectedTaxes, tax);
		
	}

	@Test
	/**
	 * Test to calculate gross income with no hours.
	 * Since there are no hours, then there should be no gross
	 */
	public void testCalculateGrossWithNoHours() {
		final double expectedGross = 0;
		
		double gross = TaxCalculator.calculateGross(0);
		
		Assert.assertEquals(expectedGross, gross);
	}
	
	@Test
	/**
	 * Test to calculate gross income with 40 hours.
	 * This is to make sure the wages are calculated correctly without
	 * hitting overtime.
	 */
	public void testCalculateGrossWith40Hours(){
		final double expectedGross = 500;
		
		double gross = TaxCalculator.calculateGross(40);
		
		Assert.assertEquals(expectedGross, gross);
	}
	
	@Test
	/**
	 * Test to calculate gross income with 50 hours.
	 * This is to make sure the wages are calculated correctly when
	 * hitting overtime.
	 */
	public void testCalculateGrossWith50Hours(){
		final double expectedGross = 687.5;
		
		double gross = TaxCalculator.calculateGross(50);
		
		Assert.assertEquals(expectedGross, gross);
	}

	@Test
	public void testCalculateNetWithNoHours() {
		final double expectedNet = 0;
		
		double net = TaxCalculator.calculateNet(0);
		
		Assert.assertEquals(expectedNet, net);
	}

}
